package com.demo.common.redis.delay;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;

/**
 * <p>
 * 分数计算工具类
 * </p>
 *
 * @author molong
 * @date 2022/6/22
 */
public class ScoreUtil {

    private ScoreUtil(){}

    public static final LocalDateTime START_TIME = LocalDateTime.of(LocalDate.of(2021, 1, 1), LocalTime.MIN);

    /**
     * 计算两个时间的毫秒数
     * @param delayTime 延迟时间
     * @return 差值
     */
    public static double getScore(LocalDateTime delayTime){
        //计算两个时间的毫秒数
        return ChronoUnit.MILLIS.between(START_TIME, delayTime);
    }
}
